package com.jinzhuo.music.service;

import com.jinzhuo.music.dao.ConsumerMapper;
import com.jinzhuo.music.domain.Consumer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ConsumerServiceImpl implements ConsumerService {
    @Autowired
    private ConsumerMapper consumerMapper;

    /**
     * 添加
     *
     * @param pojo
     */
    @Override
    public boolean addConsumer(Consumer pojo) {
        return consumerMapper.addConsumer(pojo)>0;
    }

    /**
     * 修改
     *
     * @param pojo
     */
    @Override
    public boolean updateConsumer(Consumer pojo) {
        return consumerMapper.updateConsumer(pojo)>0;
    }

    /**
     * 删除
     *
     * @param id
     */
    @Override
    public boolean deleteConsumer(Integer id) {
        return consumerMapper.deleteConsumer(id)>0;
    }

    /**
     * 根据主键查询单个对象
     *
     * @param id
     */
    @Override
    public Consumer getConsumer(Integer id) {
        return consumerMapper.getConsumer(id);
    }

    /**
     * 查询所有歌曲
     */
    @Override
    public List<Consumer> queryAllConsumer() {
        return consumerMapper.queryAllConsumer();
    }

    /**
     * 验证密码
     *
     * @param username
     * @param password
     */
    @Override
    public boolean verifyPassword(String username, String password) {
        return consumerMapper.verifyPassword(username,password)>0;
    }

    /**
     * 根据用户名查询（账号唯一）
     *
     * @param username
     */
    @Override
    public Consumer queryConsumerByName(String username) {
        return consumerMapper.queryConsumerByName(username);
    }
}
